/*
 * Copyright (c) 2020 Fraunhofer FOKUS and others. All rights reserved.
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contact: mosaic@fokus.fraunhofer.de
 */
package org.eclipse.mosaic.fed.carla.clojure.facades;

import org.eclipse.mosaic.fed.carla.clojure.ClojureCarlaConnection;
import org.eclipse.mosaic.fed.carla.clojure.commands.TrafficLightSetState;
import org.eclipse.mosaic.fed.carla.clojure.commands.TrafficLightStateTransform;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class TrafficLightFacade {

    private final Logger log = LoggerFactory.getLogger(this.getClass());

    private final ClojureCarlaConnection carlaConnection;

    private final TrafficLightSetState trafficLightSetState;

    private final TrafficLightStateTransform trafficLightStateTransform;

    public TrafficLightFacade(ClojureCarlaConnection carlaConnection) {
        this.carlaConnection = carlaConnection;
        this.trafficLightStateTransform = carlaConnection.commandRegister.getOrCreate(TrafficLightStateTransform.class);
        this.trafficLightSetState = carlaConnection.commandRegister.getOrCreate(TrafficLightSetState.class);
    }

    public Object getCarlaTrafficLightState(Character sumoTlState) {
        return trafficLightStateTransform.execute(carlaConnection, sumoTlState);
    }

    public void setTrafficLightState(Object trafficLight, Object state) {
        trafficLightSetState.execute(carlaConnection, trafficLight, state);
    }

}
